#include "iostream"
#include "cstdio"
#include "cstring"

using namespace std;

int a[41][41]; //行x列y

int main(){
    memset(a, 0, sizeof(a));
    int n;
    cin >> n;
    int maxk;  maxk = n * n;
    int curn = 1;
    int x; int y;
    while(curn <= maxk){
        if(curn == 1){
            a[x = 1][y = n / 2 + 1] = curn++;
        }
        else if(x == 1 && y != n){
            a[x = n][++y] = curn++;
        }else if(x != 1 && y == n){
            a[--x][y = 1] = curn++;
        }else if(x == 1 && y == n){
            a[++x][y] = curn++;
        }else if(x != 1 && y != n){
            if(a[x - 1][y + 1] == 0){
                a[--x][++y] = curn++;
            }else{
                a[++x][y] = curn++;
            }
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            printf("%d ", a[i][j]);
        }
        printf("\n");
    }
    return 0;
}